package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.Autofill;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

/**
 * @Description TODO
 * @Author itheima
 * @Date 2023-07-08 18:27
 */
@Mapper
public interface CategoryMapper {

    /**
     * 增加
     * @param category
     */
    @Autofill
    void add(Category category);

    /**
     * G根据id删除
     * @param id
     */
    @Delete("delete from category where id=#{id}")
    void dlete(Long id);

    /**
     * 分页查询
     * @param name
     * @param type
     * @return
     */
    Page<Category> page(String name, Integer type);

    /**
     * 修改分类接口
     * @param build
     */
    @Autofill(OperationType.UPDATE)
    void update(Category build);

    /**
     * 根据分类查询
     * @param type
     * @return
     */
    List<Category> list(Integer type);
}
